package com.Action;
import com.Services.RecruitmentService;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ServletActionContext;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.servlet.http.HttpServletRequest;


/**
 * Created by Administrator on 2017/3/18
 * 这是用于添加公告的动作
 */
public class addGonggao extends ActionSupport {
    private String post;
    private String department;
    private String neednumbers;
    private String wage;
    private String year;
    private String month;
    private String day;
    private String content;
    private String examtype;
    private String requirement;

    public String getPost() {
        return post;
    }

    public void setPost(String post) {
        this.post = post;
    }

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public String getNeednumbers() {
        return neednumbers;
    }

    public void setNeednumbers(String neednumbers) {
        this.neednumbers = neednumbers;
    }

    public String getWage() {
        return wage;
    }

    public void setWage(String wage) {
        this.wage = wage;
    }

    public String getYear() {
        return year;
    }

    public void setYear(String year) {
        this.year = year;
    }

    public String getMonth() {
        return month;
    }

    public void setMonth(String month) {
        this.month = month;
    }

    public String getDay() {
        return day;
    }

    public void setDay(String day) {
        this.day = day;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getExamtype() {
        return examtype;
    }

    public void setExamtype(String examtype) {
        this.examtype = examtype;
    }

    public String getRequirement() {
        return requirement;
    }

    public void setRequirement(String requirement) {
        this.requirement = requirement;
    }

    @Override
    public String execute() throws Exception {
        HttpServletRequest request= ServletActionContext.getRequest();
        request.setCharacterEncoding("utf-8");
        ApplicationContext ac=new ClassPathXmlApplicationContext("applicationContext.xml");
        RecruitmentService rs=ac.getBean(RecruitmentService.class);
        //添加公告
        rs.addRecruitment(post,department,neednumbers,wage,year,month,day,content,examtype,requirement);
        return super.execute();
    }
}
